package bulk_param.numspe.controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import bulk_param.view.NumSpe_Open_View;

public class SetSelectedBoxNumSpeController implements ActionListener{

	private NumSpe_Open_View numSpe_Open_View;
	
	public SetSelectedBoxNumSpeController(NumSpe_Open_View numSpe_Open_View){
		this.numSpe_Open_View=numSpe_Open_View;
	}
	
	@Override
	public void actionPerformed(ActionEvent arg0) {
		if(!numSpe_Open_View.widerDropDownCombo.getSelectedItem().toString().trim().isEmpty()){
			if(numSpe_Open_View.widerDropDownCombo.getSelectedItem().toString().substring(0, 1).equalsIgnoreCase("R")){
				numSpe_Open_View.lbZABPQ.setText("Point(0118 XYZ) : ");
			}
			if(numSpe_Open_View.widerDropDownCombo.getSelectedItem().toString().substring(3, 4).equalsIgnoreCase("c")){
				numSpe_Open_View.lbZABPQ.setText("Point(03BPQ) : ");
			}
			if(numSpe_Open_View.widerDropDownCombo.getSelectedItem().toString().substring(3, 4).equalsIgnoreCase("8")){
				numSpe_Open_View.lbZABPQ.setText("Point(0800) : ");
			}
			if(numSpe_Open_View.widerDropDownCombo.getSelectedItem().toString().length() <=40){
				numSpe_Open_View.txtZLT.setText(numSpe_Open_View.widerDropDownCombo.getSelectedItem().toString());	
			}else{
			numSpe_Open_View.txtZLT.setText(numSpe_Open_View.widerDropDownCombo.getSelectedItem().toString().substring(0,40));
			}
		}else{
			System.out.println("VIDE");
			numSpe_Open_View.txtZLT.setText(null);				
		}
	}	
}
